<?php

declare(strict_types=1);


namespace App\Common\Redis;

use FriendsOfHyperf\Lock\Driver\LuaScripts;
use Override;

class RedisLock extends \FriendsOfHyperf\Lock\Driver\RedisLock
{
    #[Override]
    public function release(): bool
    {
        //redis采用json序列化 锁owner必须加双引号 才能解锁
        $this->owner = '"'.$this->owner.'"';
        return (bool) $this->store->eval(LuaScripts::releaseLock(), [$this->name, $this->owner], 1);
    }
}